import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {FrameComponent} from "./frame/frame.component";
import {LoginComponent} from "./login/login.component";
import {BookTypeListComponent} from "./book/book-type-list/book-type-list.component";
import {BookTypeEditComponent} from "./book/book-type-edit/book-type-edit.component";
import {BookListComponent} from "./book/book-list/book-list.component";
import {BookEditComponent} from "./book/book-edit/book-edit.component";
import {UserListComponent} from "./user/user-list/user-list.component";
import {UserEditComponent} from "./user/user-edit/user-edit.component";

const routes: Routes = [{
  path: '',
  component: FrameComponent,
  children: [{
    path: 'user-list',
    component: UserListComponent,
    data: {title: '用户列表'}
  }, {
    path: 'user-edit/:id',
    component: UserEditComponent,
    data: {title: '用户编辑'}
  }, {
    path: 'book-type-list',
    component: BookTypeListComponent,
    data: {title: '分类列表'}
  }, {
    path: 'book-type-edit/:id',
    component: BookTypeEditComponent,
    data: {title: '分类编辑'}
  }, {
    path: 'book-list',
    component: BookListComponent,
    data: {title: '图书列表'}
  }, {
    path: 'book-edit/:id',
    component: BookEditComponent,
    data: {title: '图书编辑'}
  }]
}, {
  path: 'login',
  component: LoginComponent
}];

@NgModule({
  imports: [RouterModule.forRoot(routes, {useHash: true})],
  exports: [RouterModule]
})
export class AppRoutingModule {
}
